Introduction:

In this project we will try to conceive a portfolio strategy investment. The portfolio conceived would be based on CAC40 stocks. Therefore, the first step will be to construct a benchmark portfolio by creating an index on CAC40 stocks based on their market capitalization. This first portfolio will serve as a benchmark for a more adavanced strategy that will be presented in a second part of this project.

I. Portoflio Strategy:

I.I Market Cap Benchmark:

I.I.1 Library and import data:

The first step in this project will be to import specific library that will be needed for our projects. Then, once the library installed it will be possible to import the data that we need for our study.

I.I.2 Data CAC 40:


The benchmark portfolio will be based on stocks of the CAC40. The data and ressources link to this index will be import from the YahooFinance website with the package tidyquant and its tq_get() method. (ref: https://www.rdocumentation.org/packages/tidyquant/versions/1.0.3/topics/tq_get)

CAC 40 index prices evolution

I.I.3 Construction of the Benchmark:


As we are going to construct our benchmark based on the CAC40 firms, it is first necessary to get the tickers company in order to retrieve there historical data. Therefore, we first retrieve a data set with the name of each company and their associated ticker for the yahoo finance API:

DataSet Extract
ISIN nom ticker Secteur
FR0000120073 Air Liquide AI.PA Chemicals
NL0000235190 Airbus AIR.PA Aerospace & Defence
FR0010220475 Alstom ALO.PA Industrial Metals
LU1598757687 Arcelor Mittal MT.PA Industrial Metals
FR0000120628 Axa CS.PA Life Insurance



I.I.4 Get Market Capitalisation:



Get the market capitalization for all the firms in the CAC40. Then we compute their weight in order to create our benchmark for our portfolio strategy. Two different portfolio benchmark could be use based on that. First, we make a portfolio compose all the capitalisation on the CAC40 but with the same amount invested in each. This, will be the “Equally Weighted Portfolio” (EWP). Then, the second potential potfolio is the “Market Cap wieghted Portfolio” (MWP). The weight associated with each stock will be computed as the ratio of the market capitalization link to the stock over the total market capitalization of the stocks.

I.I.5 Get data for selected stocks of the Benchmark:

We get the time series data for each firm over the past 4 years. Based on this information we will compute the historical market capitalization of the firms:

I.I.6 MarketCap Weighted Portfolio construction:

In order to construct our benchmark we need to a affect a certain weight to every assert in our cac dataset. To do so we use the market capitalisation associated to each asset. Then, we can associate a given weight to each asset by using the following formula: \[\forall i \in CAC, weight_i=\frac{market cap_i}{\sum{marketcap}}\]

Company and market cap weight
symbol AvgCap weight
TTE.PA 254789380 0.0759970
MC.PA 242569038 0.0723520
SAN.PA 187972833 0.0560674
BNP.PA 181634858 0.0541769
AIR.PA 177001613 0.0527949
OR.PA 138732910 0.0413804
CS.PA 132064776 0.0393915
SU.PA 127089239 0.0379074
KER.PA 118072972 0.0352181
AI.PA 115155615 0.0343479

We Reorder the dataframe by order of the tickers weight. Then, we can compute the portfolio return of both basic model the equaly weighted and the market cap weight by using the portofolio return:

\(\\\) We then extract the data of the CAC40 in order to compute certain metrics and measure our benchmark to the CAC40 index: \(\\\)

I.I.7 Performance metrics:

In order to have a basis to compare our future strategy with our benchmark portfolios we can compute different performance metrics of those portfolios who give us informations on the performance, risk profile and link to the market of our portfolios. The main metrics computed are the mean, the volatilty, the sharpe ratio and the Value at Risk.

Metrics comparison for EWP and MWP
EWP MWP
Mean Return(Annualized) 0.1053386 0.1003374
Volatility(Annualized) 0.2300022 0.2414825
Sharpe Ratio(Annualized) 0.4579893 0.4155060
VaR(daily basis) -0.0233164 -0.0244986
MaxDrawDown 0.1412669 0.1444111
Beta of the portfolios 0.9452871 1.0065992





The basic benchmark computed present a annualized return over 10% in both case however the portfolios present a quite high volatility resulting in a sharpe ratio below one which mean that this basic mark cap portfolio is not really optimal. As we can see with regression plot, both of the portfolio are highly correlated with the CAC40 index around 1 little bit higher than in the case of the Market Cap weighted portfolios. Which is a consistent result as we construct a benchmark very close to the real index of the CAC40 as we use most of the CAC40 firms to construct our benchmark. We will now tend to use a more dynamic approach in order to construct a portfolio base on the CAC40 stocks and compare those results to the one observe in this first part.

II. Investment strategy

II.1 Asset weight allocation and Correlation data:

We are going to base the following investments based on the 10th highest market capitalization and then try to study the link on those assets in order to construct the most efficient strategy on those stocks.

We now have the return for the 10 highest capitalisation of the past 4 years in the CAC40. In order to have a diversified portfolio it could be relevent to studied the level of correlation between those 10 assets:

Return of the 10 assets
date AI.PA AIR.PA CS.PA BNP.PA KER.PA OR.PA MC.PA SAN.PA SU.PA TTE.PA
2019-07-30 0.0076459 -0.0181427 -0.0212766 -0.0266088 -0.0161762 -0.0147352 -0.0112211 -0.0197146 -0.0237195 -0.0171660
2019-07-31 -0.0015975 0.0026620 -0.0043478 0.0158960 -0.0039249 -0.0218270 0.0021361 -0.0015878 0.0090463 -0.0042342
2019-08-01 0.0100000 0.0106200 0.0115721 0.0157658 -0.0001065 0.0132231 0.0101253 0.0003975 0.0084528 -0.0103115
2019-08-02 -0.0388119 -0.0469788 -0.0373409 -0.0395612 -0.0395144 -0.0309951 -0.0546030 -0.0168234 -0.0548641 -0.0390977
2019-08-05 -0.0049444 -0.0214042 -0.0215246 -0.0178615 -0.0189620 -0.0307239 -0.0422712 -0.0251954 -0.0225746 -0.0133021
2019-08-06 -0.0020704 -0.0064623 -0.0093951 -0.0035878 0.0098339 -0.0073817 0.0209760 -0.0015204 0.0008249 -0.0133681
2019-08-07 0.0049793 0.0173449 -0.0087902 -0.0078222 0.0006716 0.0192476 0.0205450 0.0062293 0.0021977 -0.0083821
2019-08-08 0.0272502 0.0422951 0.0203035 0.0197722 0.0203580 0.0214592 0.0296379 0.0264135 0.0183663 0.0169060
2019-08-09 -0.0152734 -0.0160428 -0.0093779 -0.0132531 -0.0032888 -0.0222689 -0.0105906 -0.0115266 -0.0183042 -0.0095650
2019-08-12 0.0069388 0.0006393 -0.0025399 -0.0134312 -0.0127585 0.0077353 -0.0214080 0.0009492 0.0016451 -0.0059784



As we can see the level of correlation between the 10 assets are quite important. It would have been good in order to diversified best our portfolio to have assets in our portfolio with negative correlation. Therefore, we are going to check is there is any assets out of the 10 highets market capitalisation that could be negatively correlated with one of our 10 assets.





We can see that all of the assets available on the CAC40 dataset are all presented with a more or less important positive correlation. Therefore, we prefer to keep to those 10 highest cap stock as they are amoung the highest perforamnce in value of the CAC40 now going to construct first an “optimal” weight allocation of those 10 stocks based on the Markowitz Theory. So from now on the test et model will be applied to the 10 following stocks from CAC40:

  • TotalEnergies
  • Schneider Electric
  • Sanofi
  • LVMH
  • L’oreal
  • Kering
  • Bnp Paribas
  • Axa
  • Airbus
  • Air Liquide

II.I.1 Portfolio Theory Application:



We have now construct a table of 100 possible allocations weight for 10 assets. Recording all the return stdev and sharpe ratio base on this new data we can find the MaxSharpeRatio Portfolio and the Min Var Portfolio. We remind that the Sharpe Ratio si computed as follow: \[Sharpe Ratio = \frac{E(Return_portfolio)-r_f}{\sigma_{Portfolio}}\] We suppose by conveniance that the risk free rate \(r_f\) is equal to 0. Then, in this context we will take the combination of weight that provide the highest sharpe ratio which means the highest risk v reward ratio. Based on the 100 simulations of allocation weight we can plot the efficient frontier and the risk v reward of our different allocations:

By doing so we have been able to find the “optimal portfolio” with the highest Sharpe ratio. We can describe visually this optimal allocation of our 10 assets:

II.I.2 ETF Construction:



Base on this portfolio analysis we construct a new index base on the 10 assets studied above. In deed we are going to compare the performance of our “home-made ETF” which will be construct of the 10 stocks allocated with the weight of the “Optimal Portfolio”.



II.1.3 Plot evolution of the artificial ETF constructed(Optimal Portfolio Weighted):





II.II Following Trend Startegy:



Base on this ETF we can follow the trend of this new index on historical data and try to optimise the P&L of this portfolio. In order to that we will apply a following trend strategy in order to look on the start of growing trend and the start of bearing trend. The technical solution to find those key day of long or short is the Simple Moving Average which general expression is given as follow: \[SMA_{i} = \frac{\sum_{i}x_i}{i}\] The idea is just to compute a moving average over the i previous day of a stock and to compare to the real value. This less precise representation of the stock will give aview on the longer trend occuring on the stock. In the case of the trend following strategy the idea is to compare the evolution a 10 days moving average (“fast SMA”) to a 50 days moving average (“slow SMA”)

II.II.1 Backtesting strategy on the 10 assets ETF:

We try to apply and back test an algorithm simple trend following strategy. The idea is to detect the start of rising price period and anticipate the start of a lower trend. In this context the method will only indicate time period where to buy (“at low price”) and when to sell (“at high price”):

We try to compute what could be the return if we use the trend following strategy on the ETF of the 10th highest market capitalisation of the CAC40.

II.II.2 Summary of our results:

Base on the trend following described earlier we were able to compute the specific return of this strategy. Therefore, we can compute the different metrics information propose earlier and compare those indicators to the one of our market cap benchmark provided in part I:

Performance metrics of the benchmark and ETF
ETF 10 Stocks ETF 10 stock w Strategy EWP Portfolio MWP Portfolio
Mean Return(Annualized) 0.1234351 0.1585530 0.1053386 0.1003374
Volatility(Annualized) 0.2371991 0.2384679 0.2300022 0.2414825
Sharpe Ratio(Annualized) 0.7839878 0.6648819 0.4579893 0.4155060

Conclusion:



The use of the portfolio theory and the max sharpe portfolio help us to get an index with better return than our benchmark. However the level of volatility is still very high the trend following strategy seems to help gain some higher profit as it present higher return than the simple passive investment in the ETF with a similar level of volatility. However, this method has been efficient in a backtesting process and it is just a theoretical return base on the past data. Furthermore, the computation where quite biased as we doesnt take into account certain cost should happen if the investments were made on the market(risk free rate different of 0, fee cost of transaction,…) To conclude, this project has been the occasion to cover different R tools and functions (ggplot, data frame manipulations, use of YahooFinance API) applied to the financial analysis with the use of portfolio management theory.